package summerbug.hanzi.model.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import summerbug.hanzi.model.HanZiTable;
import summerbug.hanzi.model.Poem;

import summerbug.hanzi.model.dao.HanZiTableDao;
import summerbug.hanzi.model.dao.PoemDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig hanZiTableDaoConfig;
    private final DaoConfig poemDaoConfig;

    private final HanZiTableDao hanZiTableDao;
    private final PoemDao poemDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        hanZiTableDaoConfig = daoConfigMap.get(HanZiTableDao.class).clone();
        hanZiTableDaoConfig.initIdentityScope(type);

        poemDaoConfig = daoConfigMap.get(PoemDao.class).clone();
        poemDaoConfig.initIdentityScope(type);

        hanZiTableDao = new HanZiTableDao(hanZiTableDaoConfig, this);
        poemDao = new PoemDao(poemDaoConfig, this);

        registerDao(HanZiTable.class, hanZiTableDao);
        registerDao(Poem.class, poemDao);
    }
    
    public void clear() {
        hanZiTableDaoConfig.clearIdentityScope();
        poemDaoConfig.clearIdentityScope();
    }

    public HanZiTableDao getHanZiTableDao() {
        return hanZiTableDao;
    }

    public PoemDao getPoemDao() {
        return poemDao;
    }

}
